﻿window.onload = function (){
    PuppetPlay.ImageCache.loadImages(function() {
        console.log(window.navigator && window.navigator.msMaxTouchPoints + ' pointers supported');
        PuppetPlay.StageScenery.init(document.getElementById('container'));
        PuppetPlay.StageScenery.loadRoles();
        PuppetPlay.StageScenery.draw();
        ExtendedSplash.remove();
    });

    if (window.Windows && !Windows.Storage.ApplicationData.current.localSettings.values['visited']) {
        document.getElementById('pp-welcome').style.display = 'block';
        document.getElementById('pp-mask').style.display = 'block';
        document.querySelector('#pp-welcome .pp-link').addEventListener('click', function () {
            document.getElementById('pp-welcome').style.display = 'none';
            document.getElementById('pp-mask').style.display = 'none';
            Windows.Storage.ApplicationData.current.localSettings.values['visited'] = true;
        });
    }
	
	document.body.addEventListener('keydown', function(e){
	    e = e || window.event;
		var keyCode = e.keyCode||e.which||e.charCode;
		if (keyCode == 32) {
			PuppetPlay.Util.setDebugMode(!PuppetPlay.Setting.DEBUG_MODE);
		}
	}, false);
};